package uncheckedexception;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025/5/12
 * Time: 21:35
 */

public class Demo {
    public static void function(int num){
        if(num == 0){
            throw new ArithmeticException();
        }
    }
    public static void test(int[] array){
        if (array == null){
            throw new NullPointerException();
        }
    }
    public static void main(String[] args){
        try {
            function(0);
            test(null);
        }/*catch (ArithmeticException e){
            System.out.println("成功捕捉到算术异常并处理");
        }catch (NullPointerException e){
            System.out.println("成功捕捉到空指针异常并处理");
        }*/finally {
            System.out.println("Hello World");
        }
        System.out.println("程序继续执行");
    }
}
